# coding: utf-8
# @Author: ChuiZi
# 设置测试用例位置,默认在"根目录/testData/testCase"
import os
from datetime import datetime

from lib.baseParams import rootPath
from lib.common.achievePath import find_targetFile


class FrameDataPathSetting:
    testCaseRelPath = r"testData\testCase"  # 测试用例文件夹所在的相对路径
    testCaseTemplat = r"options\temp\template.py"  # 测试用例自动生成模板所在的相对路径
    testCaseTempData = r"testData\temp.json"  # 测试数据临时文件
    reportRelPath = r"reports"  # 测试报告文件夹所在的相对路径
    mockPortPath = r"testData\mockPort"  # 接口模拟数据文件夹所在的相对路径


class FrameDataPath:
    # 测试用例相关
    pathTestCaseDir = os.path.join(rootPath, FrameDataPathSetting.testCaseRelPath)  # 测试用例文件夹所在的绝对路径
    pathTestCaseDirRoot = os.path.dirname(pathTestCaseDir)  # 测试数据所在的绝对路径
    pathTestCases = find_targetFile(pathTestCaseDir, "py")  # 测试用例绝对路径组成的列表
    pathTestCaseTempData = os.path.join(rootPath, FrameDataPathSetting.testCaseTempData)  # 测试数据临时文件的绝对路径
    # 测试用例模板
    pathTestCaseTemplate = os.path.join(rootPath, FrameDataPathSetting.testCaseTemplat)  # 测试用例自动生成模板所在的绝对路径
    # 测试报告相关
    pathReportRootDir = os.path.join(rootPath, FrameDataPathSetting.reportRelPath)  # 测试报告文件夹根目录的绝对路径
    pathReportDir = os.path.join(pathReportRootDir, "report")  # 测试报告文件夹所在的绝对路径
    pathReportDirAllureTemp = os.path.join(pathReportRootDir, "temp")  # allure测试报告临时文件所在的绝对路径
    pathReportAllureConfig = os.path.join(rootPath, r"options\allure\environment.properties")  # allure测试报告配置文件所在的绝对路径
    pathReportAllureUse = os.path.join(rootPath, r"options\allure\open_report.bat")  # allure测试报告配置文件所在的绝对路径
    pathReportHtmlFileName = rf"{pathReportDir}\测试报告{datetime.now().strftime('%Y%m%d')}.html"  # html测试报告命名路径
    pathReportHtmlCss = os.path.join(rootPath, r"options\html\htmlReport.css")  # html测试报告css格式文件路径
    # 接口模拟
    pathMockPortdata = os.path.join(rootPath, FrameDataPathSetting.mockPortPath, "Port.json")


if __name__ == '__main__':
    from shutil import copyfile

    print("测试数据根目录" + FrameDataPath.pathTestCaseDirRoot)
    print("测试用例所在目录" + FrameDataPath.pathTestCaseDir)
    # print(FrameDataPath.pathTestCases)
    print("测试报告根目录" + FrameDataPath.pathReportDir)
    print("html测试报告地址" + FrameDataPath.pathReportHtmlFileName)
    print("html测试报告css文件地址" + FrameDataPath.pathReportHtmlCss)
    print("接口模拟数据地址" + FrameDataPath.pathMockPortdata)
